<?php
/**
 * Nweb Editor
 *
 * This script is protected by copyright. Its use, copying, modification
 * and distribution without written consent of the author is prohibited.
 *
 * @category    source
 * @package     pl.nweb.editor.datatype
 * @author      Krzysztof Kardasz <krzysztof.kardasz@gmail.com>
 * @copyright   Copyright (c) 2012 Krzysztof Kardasz
 * @license     http://www.gnu.org/licenses/lgpl-3.0.txt  GNU Lesser General Public
 * @version     1.0 $Id$
 * @link        https://nweb-editor.googlecode.com
 * @link        http://editor.nweb.pl
 */

namespace pl\nweb\editor\datatype;

/**
 * Typ treści
 *
 * @category    source
 * @package     pl.nweb.editor.datatype
 * @author      Krzysztof Kardasz <krzysztof.kardasz@gmail.com>
 * @copyright   Copyright (c) 2012 Krzysztof Kardasz
 * @version     1.0 $Id$
 */
abstract class Content
{
    /**
     * Model wiersza tabeli
     *
     * @var \pl\nweb\editor\model\gateway\row\Content
     */
    private $_row = null;

    /**
     * Konstruktor
     *
     * @param  \pl\nweb\editor\model\gateway\row\Content $row model wiersza tabeli
     */
    final public function __construct(\pl\nweb\editor\model\gateway\row\Content $row)
    {
        $this->_row = $row;
        $this->_init();
    }

    /**
     * Inicjaliacja obiektu
     *
     * @return void
     */
    protected function _init()
    {}

    /**
     * Zwraca model wiersza tabeli
     *
     * @return \pl\nweb\editor\model\gateway\row\Content
     */
    public function getRow()
    {
        return $this->_row;
    }

    /**
     * Przedstawienie obiektu w formie tekstu
     *
     * @return string
     */
    public function __toString()
    {
        return (string)$this->getRow()->getTitle();
    }
}